package com.jinhao.crowd.handler;

import com.jinhao.crowd.entity.po.MemberPO;
import com.jinhao.crowd.exception.LoginFailedException;
import com.jinhao.crowd.service.MemberPOService;
import com.jinhao.crowd.util.CrowdConstant;
import com.jinhao.crowd.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created on 2021/10/6.
 *
 * @author Valar Morghulis
 */

@RestController
public class MemberPOHandler {

    @Autowired
    private MemberPOService memberPOService;

    @RequestMapping("/get/memberpo/by/loginacct/remote")
    public ResultEntity<MemberPO> getMemberByLoginAcct(@RequestParam("loginacct") String loginacct){

        try {

            MemberPO memberPO = memberPOService.getMemberByLoginAcct(loginacct);
            return ResultEntity.successWithData(memberPO);
        } catch (Exception e) {
            e.printStackTrace();

            return ResultEntity.failed(e.getMessage());
        }
    }
}
